package com.xlh.server.protocol.support.json;

import android.os.Handler;
import android.widget.Toast;

import com.xlh.Utils.GsonManager;
import com.xlh.Utils.MudProtocol;
import com.xlh.bean.CenterText;
import com.xlh.bean.ProtocolObject.Base;
import com.xlh.bean.ProtocolObject.Window;
import com.xlh.interf.IActivity;
import com.xlh.interf.ITakeMessage;
import com.xlh.outside.MainActivity;
import com.xlh.thread.MessageBagerTask;

/**
 * // Toast
 *
 * Created by Created by mike@Q184377367 on 2018/7/2. on 2018/7/2.
 */

public class NotificationServer implements ITakeMessage {

    private IActivity atv;
    private String hasType = "notification";
    private Base protccoObj;
    public NotificationServer(IActivity atv){
        this.atv = atv;
    }

    @Override
    public void takeMessage(String t,String s){

        if(!t.equals(this.hasType)) return;

        protccoObj =  GsonManager.gsmgr.jsonToAnyObject(s, Base.class);

        if(protccoObj==null || protccoObj.getText().equals("")) return;

        Toast.makeText(this.atv.getActivity(), protccoObj.getText(), Toast.LENGTH_LONG).show();


    }

    @Override
    public boolean takeMessage(String s) {
        return false;
    }

    @Override
    public void init() {

    }

    @Override
    public void atViewLoadAfterInit() {

    }






}
